import h from './mysnabbdom/h.js'
import patch from './mysnabbdom/patch.js'


// const myVnode = h('h1', {}, '你好')
const myVnode = h('ul', {}, [
	h('li', {key: 'A'}, 'A'),
	h('li', {key: 'B'}, 'B'),
	h('li', {key: 'C'}, 'C'),
	h('li', {key: 'D'}, 'D'),
	h('li', {key: 'E'}, 'E')
])
// 得到盒子和按钮
const btn = document.getElementById('btn')
const container = document.getElementById('container')

// 第一次上树
patch(container, myVnode)

// 新节点
const myVnode2 = h('ul', {}, [
	h('li', {key: 'CQ'}, 'CQ'),
	h('li', {key: 'A'}, 'A'),
	h('li', {key: 'B'}, 'B'),
	h('li', {key: 'C'}, 'C'),
	h('li', {key: 'D'}, 'D'),
	h('li', {key: 'E'}, 'E')
])
btn.onclick = function () {
	patch(myVnode, myVnode2)
}